﻿using HotelRegistrationSystem.Models.AttributeValidators;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HotelRegistrationSystem.Models
{
    public class OwnerBookingModel
    {
        [Display(Name = "Hotel name: ")]
        public string HotelName { get; set; }

		public int HotelId { get; set; }

        [Display(Name = "Room name: ")]
        public string RoomName { get; set; }

        [Display(Name = "Room price: ")]
        public decimal RoomPrice { get; set; }

        [Display(Name = "Room type: ")]
        public string RoomType { get; set; }

        [Display(Name = "Bed count")]
        public int BedCnt { get; set; }

        public int RoomId { get; set; }

        //public List<RoomModel> Rooms { get; set; }

        //[Required(ErrorMessage = "Please select a room")]
        //public int SelectedRoom { get; set; }

        public List<string> Usernames { get; set; }

        [Required(ErrorMessage = "Please select an user")]
        public string SelectedUsername { get; set; }

        [DataType(DataType.DateTime)]
        [MinDate]
        [Required]
        public DateTime StartDate { get; set; }

        [DataType(DataType.DateTime)]
        [MinDate]
        [Required]
        public DateTime EndDate { get; set; }

        public OwnerBookingModel() { }

        public OwnerBookingModel(string hotelName, int hotelId, string roomName, decimal? roomPrice, string roomType, int roomId, int bedCnt, 
            List<string> usernames)//, List<RoomModel> rooms)
        {
            StartDate = DateTime.Now.AddDays(1);
            EndDate = DateTime.Now.AddDays(1);
            HotelName = hotelName;
			HotelId = hotelId;
            RoomName = roomName;
            RoomPrice = roomPrice.HasValue ? roomPrice.Value : 0m;
            RoomType = roomType;
            RoomId = roomId;
            BedCnt = bedCnt;
            Usernames = usernames;
            //Rooms = rooms.ToList();
        }
    }
}